package com.principle.demeter;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;

public class Demeter1 {
    public static void main(String[] args) {
        SchoolManage schoolManage = new SchoolManage();
        schoolManage.printAll();
    }
}
//学员员工类
class Collage{
    int id;
    public Collage(int id){
        this.id = id;
    }
}
class School{
    int id;
    public School(int id){
        this.id = id;
    }
}
/**
 * 学院员工管理类
 */
class CollageManage{
    //返回学院员工名单
    public List<Collage> getCollage(){
        List collages = new ArrayList();
        for (int i = 0; i < 10; i++) {
            collages.add(new Collage(i));
        }
        return collages;
    }
    //将打印学院员工的细节封装在这个方法中,减少其他类对我们的“知道‘
    public void printCollage(){
        List<Collage> collage = getCollage();
        for (Collage collage1 : collage) {
            System.out.println("学院员工:" + collage1.id);
        }
    }
}
/**
 * 学校管理类
 */
class SchoolManage{
    //返回学校员工list
    public List<School> getSchool(){
        List schools = new ArrayList();
        for (int i = 0; i < 5; i++) {
            schools.add(new School(i));
        }
        return schools;
    }
    //打印学院员工和学校员工
    public void printAll(){
        CollageManage collageManage = new CollageManage();
        //哪怕要修改打印的细节，在这里也不需要修改
        collageManage.printCollage();
        System.out.println("=======================");
        List<School> school = this.getSchool();
        for (School school1 : school) {
            System.out.println("学校员工：" + school1.id);
        }
        System.out.println("hello wrold");
    }
}
